package com.example.test.mapper;

import com.example.test.entity.User;
import org.apache.ibatis.annotations.*;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
  @Mapper
  @Transactional
public interface UserMapper {

  @Select("select count(*) from user where username =#{username}  and password = #{password}")
    public boolean findByName(String username,String password);
  @Select("select username,id from user")
    List<User> getUsername(String username,Integer id);

  @Insert("insert into user values(#{id},#{username},#{password})")
  public Boolean InsertUser(String username,String password,Integer id);

  @Insert("insert into user values(#{id},#{username},#{password})")
    public int Insert(User user);

  @Select("select * from user")
    List<User> getUser();

  @Delete("delete from user where username = #{username}")
    boolean deleteUser(String username);
  }
